package leetcode_301_400;

import java.util.Arrays;

public class LeeCode_396 {
    public static void main(String[] args) {

    }
    private static int maxRotateFunction(int[] nums) {
        int numSum = Arrays.stream(nums).sum();
        int n = nums.length;
        int f = 0;
        for (int i = 0; i < n; i++) {
            f += i * nums[i];
        }
        int ans = f;
        for (int i = n - 1; i > 0; i--){
            f += numSum - n * nums[i];
            ans = Math.max(ans, f);
        }
        return ans;
    }
}
